import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';

@Entity('h5_users')
export class H5User {
  @ApiProperty({ description: '用户ID' })
  @PrimaryGeneratedColumn()
  id: number;

  @ApiProperty({ description: '用户名' })
  @Column({ length: 50, unique: true })
  username: string;

  @ApiProperty({ description: '密码' })
  @Column({ length: 255 })
  password: string;

  @ApiProperty({ description: '昵称' })
  @Column({ length: 100, nullable: true })
  nickname: string;

  @ApiProperty({ description: '邮箱' })
  @Column({ length: 100, nullable: true })
  email: string;

  @ApiProperty({ description: '手机号' })
  @Column({ length: 20, nullable: true })
  phone: string;

  @ApiProperty({ description: '头像' })
  @Column({ length: 255, nullable: true })
  avatar: string;

  @ApiProperty({ description: '状态：0-禁用，1-启用' })
  @Column({ default: 1 })
  status: number;

  @ApiProperty({ description: '最后登录时间' })
  @Column({ nullable: true })
  lastLoginAt: Date;

  @ApiProperty({ description: '创建时间' })
  @CreateDateColumn()
  createdAt: Date;

  @ApiProperty({ description: '更新时间' })
  @UpdateDateColumn()
  updatedAt: Date;
}
